<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<s:url value="/css/style.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
		<script type="text/javascript"
			src="<s:url value="/js/jquery-1.3.2.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.bgiframe.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.ajaxQueue.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/thickbox-compressed.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.autocomplete.js"/>"></script>
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/jquery.autocomplete.css"/>" />
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/thickbox.css"/>" />
		<script type="text/javascript"
			src="<s:url value="/js/jquery.blockUI.js"/>"></script>
		<link href="<s:url value="/css/jquery.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>"></script>
		<script type="text/javascript">
	    $(document).ready(function(){
	        $('#selBookingStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selBookingEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selCheckinStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selCheckinEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selCancelStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selCancelEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selClassStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selClassEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#punishStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#punishEndTime').datepicker( {dateFormat :'yy-mm-dd'});
            $("#selStudent").autocomplete("<s:url value="/customer/Leads/autoCompleteAjax.action"/>", {
	              width: 300,
	              minChars:2, //几个字
	              mastMatch:true,
	              selectFirst: false,
	              max:  20,
	           	  formatItem: function(row, i, max) {
	           	      //alert(row);
	           	      var d=eval("("+row+")");
	           	      //alert(d);
				      return  d.name+" "+ d.card +" " + d.tel;
		         },
			     formatMatch: function(row, i, max) {
			         var d=eval("("+row+")");
	 			     return  d.name+" "+ d.card +" " + d.tel;
			     },
			     formatResult: function(row) {
			        // alert(row);
			         var d=eval("("+row+")");
				     return d.name+" "+ d.card ;
	     	      }
             });
             $("#selStudent").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selStudentId").val(d.id);
             });
              $("#selBookingUser").autocomplete("<s:url value="/system/User/autoCompleteCRAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
             });
             $("#selBookingUser").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selBookingUserId").val(d.id);
             });
             $("#selCheckinUser").autocomplete("<s:url value="/system/User/autoCompleteCRAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
             $("#selCheckinUser").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selCheckinUserId").val(d.id);
            });
             $("#selCancelUser").autocomplete("<s:url value="/system/User/autoCompleteCRAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
             });
             $("#selCancelUser").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selCancelUserId").val(d.id);
             });
              $("#selTeacher").autocomplete("<s:url value="/data/Teacher/autoCompleteAjax.action"/>", {
              width: 260,
              minChars:1, //几个字
              selectFirst: false,
              max:  20,
           	  formatItem: function(row, i, max) {
           	      //alert(row);
           	      var d=eval("("+row+")");
           	      //alert(d);
			      return  d.name;
	         },
		     formatMatch: function(row, i, max) {
		        var d=eval("("+row+")");
 			    return d.name;
		     },
		     formatResult: function(row) {
		        // alert(row);
		         var d=eval("("+row+")");
			     return d.name;
     	      }
           }
           );
           	$("#selTeacher").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selTeacherId").val(d.id);
           });
           $("#selTime").change(function(){
                $('#selClassEntityId').val("");
           });
           $('#selDate').datepicker(
	    	   { dateFormat:'yy-mm-dd',
	    	     onSelect: function(dateText, inst) {
	    	         $('#selTime').val("");
	    	         $('#selClassEntityId').val("");
	    	         $('#listForm').submit();
	    	    }
	    	});
    });
   //选到某节课
    function doSelectCheckinEntityById(Eid){
          var o=$('#selClassEntityId').val();
          if  (o==Eid){
            return;
          }
          $("#"+Eid).css({'background-color' : "#A7CDF7", 'font-weight' : 'bolder'});
          var o=$('#selClassEntityId').val();
          if (o){
            $("#"+o).css({'background-color' : "#D7E9FC", 'font-weight' : 'normal'});
          }
          $('#selClassEntityId').val(Eid);
          $('#listForm').submit();
    };
    function doSubmit() {
		var t=$('#listForm');
        t.attr('action','list');
		$('#listForm').submit();
	};
    function doAdvanceSearch() {
		var t=$('#listForm');
        t.attr('action','advanceList');
		$('#listForm').submit();
	};
 	function reset(){
	    $("input[id^='sel']").each(function(){
	           $(this).val("");
	     });
	    $("select[id^='sel']").each(function(){
	           $(this).val("");
	     });
	};
	function changedisplay(el){
		el.toggle("fast",function() {
			 //$Container.getContainerProxy().resize();
		});
	}
	function doPunish(){
  	    var ids = getSelectionIds('a');
	    if(ids.length<1){
		    alert("please select least one students");
		    return;
	    };
	    $('#ids').val(ids);
	   	var t=$('#listForm');
        t.attr('action',t.attr('action').replace('list','doPunish'));
		$('#listForm').submit();
    };
    </script>
	</head>
	<body>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="9">
					<img src="../img/right/bgl.gif" width="9" height="9" />
				</td>
				<td width="100%" class="bgline1"></td>
				<td width="9">
					<img src="../img/right/bgr.gif" width="9" height="9" />
				</td>
			</tr>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="box">
				   <s:set name="trueAction" value="trueAction" />
					<s:form action="ClassCheck/%{#trueAction}" name="listForm" id="listForm"
						namespace="/academic">
						<table width="100%" border="0" cellpadding="0" cellspacing="0"
							class="searchbg">
							<tr>
								<td>
									<input type="hidden" id="startIndex" name="startIndex"
										value="0" />
									Date:
									<s:date name="selDate" format="yyyy-MM-dd" var="showTimefmt" />
									<s:textfield value="%{#showTimefmt}" size="12" name="selDate"
										id="selDate" />
									Time
									<s:select id="selTime" name="selTime" headerKey=""
										headerValue="------all------" list="checkMessageMap"
										listKey="key" listValue="value" />
									<img src="<s:url value="/img/right/btns.gif"/>" border="0"
										onclick="javascript:doSubmit();" align="absmiddle" />
									<img src="<s:url value="/img/right/btn-s2.gif"/>" border="0"
										style="cursor: pointer" align="absmiddle"
										onclick="javascript:changedisplay($('#div1'));" />
									<br>
								</td>
							</tr>
						</table>
						<div id='div1' style="display: none;">
							<table width="100%" border="0" cellpadding="0" cellspacing="0"
								bgcolor="#E0F5FF">
								<tr>
									<td height="40">
									    &nbsp;Student:
									    <s:textfield id="selStudent" size="30" name="leads.name" />
									    <s:hidden id="selStudentId" name="leads.id" />
										&nbsp;Status
								        <s:select id="selClassStatus" name="classStatus"
										listKey="name()" headerKey="" headerValue="--all--"
										list="@com.ef.constant.ELeadsClassStatus@values()"></s:select>
									    &nbsp;Year:
									    <s:select id="year" list="{2009,2010,2011,2012}" name="year">
									    </s:select>
									    &nbsp;Week:
									    <s:select id="week"
										   list="{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52}"
										   name="week">
									    </s:select>
									   	<img src="<s:url value="/img/right/btns.gif"/>" border="0"
										onclick="javascript:doAdvanceSearch();" align="absmiddle" />
								 		<img src="<s:url value="/img/right/btn4.gif"/>" border="0"
										style="cursor: pointer" align="absmiddle"
										onclick="javascript:reset();" />
									</td>
								</tr>
								<tr>
								  	<td height="40">
								    	&nbsp;Teacher:
										<s:textfield id="selTeacher" name="classEntityTeacher.name"
											cssClass="input2" size="10" />
										<s:hidden id="selTeacherId" name="classEntityTeacher.id" />
										 &nbsp;ClassDate:
										<s:textfield id="selClassStartTime"
											name="selClassStartTime" cssClass="input2" size="10" />
										-
										<s:textfield id="selClassEndTime" name="selClassEndTime"
											cssClass="input2" size="10" />
										 &nbsp;ClassTime:
										 <s:select  name="classEntityClassTime"
										listKey="name()" headerKey="" headerValue="--all--"
										list="@com.ef.constant.ETimeline@values()"></s:select>
									</td>
								</tr>
								<tr>
								  	<td height="40">
								    	&nbsp;ClassType: 
										<s:select id="selClassType" name="classEntityClassType.id"
										listKey="id"  listValue="name"  headerKey="" headerValue="--all--"
										list="classTypeList"></s:select>
										ClassFocus:
										<s:select id="selClassFocus" name="classEntityClassFocus.id"
										listKey="id"  listValue="name"  headerKey="" headerValue="--all--"
										list="classFocusList"></s:select>
										ClassLevel: 
										<s:select id="selClassLevel" name="classEntityClassLevel.id"
										listKey="id"  listValue="name"  headerKey="" headerValue="--all--"
										list="classLevelList"></s:select>
									</td>
								</tr>
								<tr>
									<td height="40">
										&nbsp;BookingUser:
										<s:textfield id="selBookingUser" name="bookingUser.name"
											cssClass="input2" size="10" />
										<s:hidden id="selBookingUserId" name="bookingUser.id" />
										&nbsp;BookingTime:
										<s:textfield id="selBookingStartTime"
											name="selBookingStartTime" cssClass="input2" size="10" />
										-
										<s:textfield id="selBookingEndTime" name="selBookingEndTime"
											cssClass="input2" size="10" />
										&nbsp;CheckinUser:
										<s:textfield id="selCheckinUser" name="checkinUser.name"
											cssClass="input2" size="10" />
										<s:hidden id="selCheckinUserId" name="checkinUser.id" />
										&nbsp;CheckinTime:
										<s:textfield id="selCheckinStartTime"
											name="selCheckinStartTime" cssClass="input2" size="10" />
										-
										<s:textfield id="selCheckinEndTime" name="selCheckinEndTime"
											cssClass="input2" size="10" />
									</td>
								</tr>
								<tr>
									<td height="40">
										&nbsp;CancelUser:
										<s:textfield id="selCancelUser" name="cancelUser.name"
											cssClass="input2" size="10" />
										<s:hidden id="selCancelUserId" name="cancelUser.id" />
										&nbsp;CancelTime:
										<s:textfield id="selCancelStartTime" name="selCancelStartTime"
											cssClass="input2" size="10" />
										-
										<s:textfield id="selCancelEndTime" name="selCancelEndTime"
											cssClass="input2" size="10" />
									
									</td>
								</tr>
							</table>
						</div>
						<table>
							<tr>
								<td>
									<table id="classtable" class="box2" cellpadding="1"
										cellspacing="1">
										<s:set var="cols" value="10" />
										<s:set var="classEntityId" value="selClassEntityId" />
										<s:hidden name="selClassEntityId" id="selClassEntityId" />
										<s:iterator value="allClassEntity" status="st">
											<s:if test="#st.index % #cols == 0">
												<tr>
											</s:if>
											<s:if test="id==#classEntityId">
												<td id="<s:property value="id" />" bgcolor="#A7CDF7"
													align="center" style="font-weight: bolder"
													onclick="javascript:doSelectCheckinEntityById('<s:property value="id" />');">
													<s:property value="message" />
												</td>
											</s:if>
											<s:else>
												<td id="<s:property value="id" />" class="tablecolour2"
													onclick="javascript:doSelectCheckinEntityById('<s:property value="id" />');">
													<s:property value="message" />
												</td>
											</s:else>
											<s:if test="(#st.index+1) % #cols == 0">
												</tr>
											</s:if>
											<s:elseif test="#st.last">
												<s:bean name="org.apache.struts2.util.Counter">
													<s:param name="first" value="(#st.index+1) % #cols" />
													<s:param name="last" value="#cols - 1" />
													<s:iterator>
														<td class="tablecolour2">
															&nbsp;
														</td>
													</s:iterator>
												</s:bean>
												</tr>
											</s:elseif>
										</s:iterator>
									</table>
								</td>
							</tr>
						</table>
						<table>
							<tr>
								<td>
									<img src="<s:url value="/img/right/ps.gif"/>"
										onclick="javascript:doPunish();" border="0" align="absmiddle" />
								</td>
								<td>
								 &nbsp;From:
										<s:textfield id="punishStartTime"
											name="punishStartTime" cssClass="input2" size="10" />
										To
										<s:textfield id="punishEndTime" name="punishEndTime"
											cssClass="input2" size="10" />
								
								</td>
							</tr>
						</table>
						<table id="curLeadsClasses" width="100%" border="0"
							cellpadding="0" cellspacing="1" class="box2">
							<tr>
								<td class="tablecolour1">
									<s:hidden name="ids" id="ids" />
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Name
								</td>
								<td class="tablecolour1"  nowrap="nowrap">
									Telephone
								</td>
								<td class="tablecolour1"  nowrap="nowrap">
									EliteCard
								</td>
								<td class="tablecolour1"  nowrap="nowrap">
									Class
								</td>
								<td class="tablecolour1"  nowrap="nowrap">
									Booking Time
								</td>
								<td class="tablecolour1"  nowrap="nowrap">
									BookingUser
								</td>
								<td class="tablecolour1"  nowrap="nowrap">
									Checkin Time
								</td>
								<td class="tablecolour1"  nowrap="nowrap">
									CheckinUser
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Cancel Time
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									CancelUser
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Status
								</td>
							</tr>
							<s:iterator value="listResult.items" status="status">
								<tr title="entity">
									<td class="tablecolour2">
										<input type="checkbox" name="a"
											value="<s:property value="id" />" />
									</td>
									<td class="tablecolour2"  nowrap="nowrap">
										<s:property value="leads.name" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="leads.telephone" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="leads.eliteCard" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="classEntity.message" />
										[<s:date name="classEntity.classDate" format="yyyy-MM-dd" />]
										[<s:property value="classEntity.classTime" />]
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:date format="yyyy-MM-dd HH:mm:ss" name="bookingTime" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="bookingUser.name" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:date format="yyyy-MM-dd HH:mm:ss" name="checkinTime" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="checkinUser.name" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:date format="yyyy-MM-dd HH:mm:ss" name="cancelTime" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="cancelUser.name" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="status" />
									</td>
								</tr>
							</s:iterator>
						</table>
						<s:include value="/common/page.jsp"></s:include>
					</s:form>
				</td>
			</tr>
		</table>
		<s:include value="/common/down.jsp"></s:include>
	</body>
</html>
